<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
	class emp_register extends CI_Controller 
	{
		public function __construct()
		{
			parent::__construct();
			$this->load->helper('url');
			$this->load->model('emp_register_model');
		}
		
		public function index()
		{
			$this->load->helper('url');
			$this->load->view('template/header');
			$this->load->view('template/menu');
			$this->load->view('emp_register');
			$this->load->view('template/footer');
		}
		
		public function emp_login()
		{
			$this->load->helper('url');
			$this->load->view('template/header');
			$this->load->view('template/menu');
			$this->load->view('emp_login');
			$this->load->view('template/footer');
		}
		
		// employer Login
		public function do_login()
		{
			if(isset($_POST['user_name']))
			{
				$username = $this->input->post('user_name');
				$password = md5($this->input->post('password'));
				$status = 1;
				$result = $this->emp_register_model->do_login($username,$password,$status);
					if(!empty($result)){
						echo "Yes";
						
					}else{
						echo "No";
						return false;
					}
			}
			return false;
		}
		// emp logout
		public function do_logout()
		{
			$newdata = array(
				'emp_id' => '',
				'emp_user_name' => '',
				'emp_email' => '',
				'logged_in' => FALSE
			);
			$this->session->unset_userdata($newdata);
			$this->session->sess_destroy();
			$this->emp_login();
			
		}
		
		// after emp logged out
		public function after_emplogout()
		{
			$this->load->view('template/header');
			$this->load->view('template/menu');
			$this->load->view('emp_login');
			$this->load->view('template/footer');
		}
		
		// view employer
		public function emp_account()
		{
			if(($this->session->userdata('emp_email')!=""))
			{
				$this->load->view('template/header');
				$this->load->view('emp_account_header');
				$this->load->view('emp_account');
				$this->load->view('can_account_footer');
			}else{
				$this->emp_login();
			}
		}
		
		// view emp profile
		public function emp_profile()
		{
			$emp_email = $this->session->userdata('emp_email');
			if(!empty($emp_email))
			{
				$this->load->view('template/header');
				$this->load->view('emp_account_header');
				$data['single_emp'] = $this->emp_register_model->get_empprofile($emp_email);
				$this->load->view('emp_profile',$data);
				$this->load->view('can_account_footer');
			}else{
				$this->emp_login();
			}
		}
		
		
	} // end class


?>